package it.uniroma2.cloud.util;

import java.io.IOException;
import java.util.Collection;

import org.jclouds.compute.ComputeService;
import org.jclouds.compute.RunScriptOnNodesException;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.scriptbuilder.domain.Statement;

public interface ProviderHelper {

	LoginCredentials getLoginCredentials() throws IOException;

	Iterable<? extends NodeMetadata> listRunningNodesInGroup(
			ComputeService computeService, String groupName);

	void runScriptOnGroup(ComputeService compute, String groupName,
			Statement command) throws RunScriptOnNodesException;

	void runScriptOnInstance(ComputeService compute,
			String instanceName, Statement command)
			throws RunScriptOnNodesException;

	Template getTemplate(ComputeService computeService);
	
	void updateLoadBalancer(ComputeService computeService, Collection<String> ips);
	
	Collection<String> getPrivateIpsInGroup(ComputeService computeService, String groupName);
	
	Collection<String> getReachableIpsInGroup(ComputeService computeService,
			String groupName);
	
	String getReachableIp(ComputeService computeService, NodeMetadata node);

	void destroyNode(ComputeService computeService, NodeMetadata node);
	
	NodeMetadata getNodeByReachableIp(ComputeService computeService, String groupName, String ip);
	
	String getLoadBalancerAddress(ComputeService computeService);
	
	String getMonitoringAddress(ComputeService computeService);
	
	int howManyRunningWorkerNodes(ComputeService computeService);
}
